import { BaseEntity } from '../../base/entity/base';
import { Column, Entity, Index } from 'typeorm';

/**
 * 订单商品
 */
@Entity('order_goods')
export class OrderGoodsEntity extends BaseEntity {
  @Index()
  @Column({ comment: '订单ID' })
  orderId: number;

  @Index()
  @Column({ comment: '商品ID' })
  goodsId: number;

  @Column({ comment: '商品名称', length: 255 })
  goodsName: string;

  @Column({ comment: '购买数量' })
  quantity: number;

  @Column({
    comment: '单价',
    type: 'decimal',
    precision: 10,
    scale: 2,
    default: 0.0,
  })
  price: number;

  @Column({ comment: '规格参数', type: 'text', nullable: true })
  specifications: string;
}
